package com.letfox.common.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * 该类用于生成唯一服务密钥
 */
public class ServiceKeyUtil {
	
	public static String createServiceKey(){
		SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.LONG_FORMAT);
		String timeLong = sdf.format(new Date());
		Random random = new Random();
		
		int s = random.nextInt(100000) % (100000 - 30000 + 1) + 30000;
		timeLong = timeLong + ConvertTool.toString(s);
		
		String key = MD5Util.MD5(timeLong);
		return key;
	}
	
	public static void main(String[] args) {
		System.out.println(ServiceKeyUtil.createServiceKey());
	}
}
